<?php
namespace app\admin\validate;

use \think\Validate;

class Variable extends Validate
{
    use \app\common\validate\Validate;

    protected $rule = [
        'key'           => ['require','length:2,25','unique:variable,key'],
        //                  ||必须存在,长度限制,独一无二
        'type'          => ['require','exist:variable_type,type'],
    ];

    protected $message = [
        'key.require'   => '变量参数必须填写',
        'key.unique'    => '变量名称已存在',
        'key.length'    => '变量名称必须大于3个字符小于25个字符',
        'type.length'   => '输入框类型必须大于3个字符小于25个字符',
    ];

    protected $scene = [
        'add'  => ['key', 'type'],
        'edit' => ['type'],
    ];

}
